From dceb149ca498c10c51e8188d04070535ceb945c7 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 12 Aug 2010 04:39:28 +0200 Subject: [PATCH] testgtk: Convert WM hints example to use gdk_window_set_icon_list() gdk_window_set_icon() is about to go away. Also removes the circles.xbm file and uses the oncluded openfile logo instead. --- tests/Makefile.am | 1 - tests/circles.xbm | 46 ---------------------------------------------- tests/testgtk.c | 29 +++++++++++------------------ 3 files changed, 11 insertions(+), 65 deletions(-) delete mode 100644 tests/circles.xbm diff --git a/tests/Makefile.am b/tests/Makefile.am index 38d3ae4522..4fa4321218 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -366,7 +366,6 @@ EXTRA_DIST += \ testgtk.1 \ testgtkrc \ testgtkrc2 \ - circles.xbm \ 3DRings.xpm \ FilesQueue.xpm \ Modeller.xpm \ diff --git a/tests/circles.xbm b/tests/circles.xbm deleted file mode 100644 index d82f655848..0000000000 --- a/tests/circles.xbm +++ /dev/null @@ -1,46 +0,0 @@ -#define circles_width 64 -#define circles_height 64 -static unsigned char circles_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, - 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, - 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, - 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x3f, 0x00, - 0x80, 0xff, 0x1f, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, - 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xc0, 0xff, 0x01, 0x00, - 0x00, 0xf0, 0x7f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, - 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xf0, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x01, 0xf8, 0x1f, 0x00, 0x20, 0x00, 0x00, 0xff, 0x03, - 0xf8, 0x0f, 0x00, 0xff, 0x07, 0x00, 0xfe, 0x03, 0xfc, 0x07, 0xc0, 0xff, - 0x1f, 0x00, 0xfc, 0x07, 0xfc, 0x07, 0xf0, 0xff, 0x7f, 0x00, 0xfc, 0x07, - 0xfc, 0x03, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0x07, 0xfe, 0x03, 0xfc, 0xff, - 0xff, 0x01, 0xf8, 0x0f, 0xfe, 0x01, 0xfe, 0x8f, 0xff, 0x03, 0xf0, 0x0f, - 0xfe, 0x01, 0xfe, 0x01, 0xfc, 0x03, 0xf0, 0x0f, 0xff, 0x01, 0xff, 0x00, - 0xf8, 0x07, 0xf0, 0x1f, 0xff, 0x00, 0x7f, 0x00, 0xf0, 0x07, 0xe0, 0x1f, - 0xff, 0x80, 0x3f, 0x00, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, - 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, - 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x0f, 0x00, - 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0xc0, 0x0f, 0x00, 0x80, 0x1f, 0xe0, 0x1f, - 0xff, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, - 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, - 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x81, 0x3f, 0x00, - 0xe0, 0x0f, 0xf0, 0x1f, 0xfe, 0x01, 0x7f, 0x00, 0xf0, 0x07, 0xf0, 0x0f, - 0xfe, 0x01, 0xff, 0x00, 0xf8, 0x07, 0xf0, 0x0f, 0xfe, 0x03, 0xfe, 0x01, - 0xfc, 0x03, 0xf8, 0x0f, 0xfc, 0x03, 0xfe, 0x8f, 0xff, 0x03, 0xf8, 0x07, - 0xfc, 0x07, 0xfc, 0xff, 0xff, 0x01, 0xfc, 0x07, 0xfc, 0x07, 0xf8, 0xff, - 0xff, 0x00, 0xfc, 0x07, 0xf8, 0x0f, 0xf0, 0xff, 0x7f, 0x00, 0xfe, 0x03, - 0xf8, 0x1f, 0xc0, 0xff, 0x1f, 0x00, 0xff, 0x03, 0xf0, 0x1f, 0x00, 0xff, - 0x07, 0x00, 0xff, 0x01, 0xf0, 0x3f, 0x00, 0x20, 0x00, 0x80, 0xff, 0x01, - 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x01, 0x00, - 0x00, 0xf0, 0x7f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, - 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00, - 0x80, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, - 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0xff, - 0xff, 0xff, 0x01, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/tests/testgtk.c b/tests/testgtk.c index 6e40600c8d..7ee83ad162 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -49,7 +49,6 @@ #include "prop-editor.h" -#include "circles.xbm" #include "test.xpm" gboolean @@ -7431,10 +7430,9 @@ create_wmhints (GtkWidget *widget) GtkWidget *button; GtkWidget *box1; GtkWidget *box2; - GdkBitmap *circles; GdkWindow *gdk_window; - cairo_surface_t *image; - cairo_t *cr; + GdkPixbuf *pixbuf; + GList *list; if (!window) { @@ -7453,25 +7451,20 @@ create_wmhints (GtkWidget *widget) gtk_widget_realize (window); gdk_window = gtk_widget_get_window (window); - circles = gdk_pixmap_new (gdk_window, circles_width, circles_height, 1); - cr = gdk_cairo_create (circles); - image = cairo_image_surface_create_for_data (circles_bits, CAIRO_FORMAT_A1, - circles_width, circles_height, - circles_width / 8); - cairo_set_source_surface (cr, image, 0, 0); - cairo_surface_destroy (image); - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); - cairo_paint (cr); - cairo_destroy (cr); - gdk_window_set_icon (gdk_window, NULL, - circles, circles); + pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile); + list = g_list_prepend (NULL, pixbuf); - gdk_window_set_icon_name (gdk_window, "WMHints Test Icon"); + gdk_window_set_icon_list (gdk_window, list); + + g_list_free (list); + g_object_unref (pixbuf); + gdk_window_set_icon_name (gdk_window, "WMHints Test Icon"); + gdk_window_set_decorations (gdk_window, GDK_DECOR_ALL | GDK_DECOR_MENU); gdk_window_set_functions (gdk_window, GDK_FUNC_ALL | GDK_FUNC_RESIZE); - + box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), box1); gtk_widget_show (box1); -- 2.30.2